$(function () {
    $(".submit—btn").click(function (e) {
        var username = $("[name='username']").val();
        var truename = $("[name='truename']").val();

        var gender = undefined;
        if ($("[name='RadioGroup1']")[0].checked) {
            gender = '男'
        } else {
            gender = '女'
        }
        var phone = $("[name='phone']").val();
        var email = $("[name='email']").val();

        params = {
            'username': username,
            'truename': truename,
            'gender': gender,
            'phone': phone,
            'email': email
        };
        $.ajax({
            url: "/user/user_info",
            type: "post",
            data: JSON.stringify(params),
            contentType: "application/json",
        }).success(function (resp) {
            if (resp.errno == '0') {
                location.reload();
            } else {
                alert(resp.errmsg);
            }
        }).error(function () {
            alert('网络异常')
        })
    });


});

